package com.hao.proxy.model;

import com.hao.proxy.enums.ProxyStatusEnum;


public class Proxy {
	private String threadName;
	private String host;
	private int port;
	private ProxyStatusEnum status;
	private int errorCount;
	private int successCount;
	
	
	
	public Proxy() {
	}

	public Proxy(String host, int port) {
		super();
		this.host = host;
		this.port = port;
		this.status = ProxyStatusEnum.UN_VERIFIED;
	}

	public String getHost() {
		return host;
	}
	
	public void setHost(String host) {
		this.host = host;
	}
	
	public int getPort() {
		return port;
	}
	
	public void setPort(int port) {
		this.port = port;
	}
	
	public ProxyStatusEnum getStatus() {
		return status;
	}
	
	public void setStatus(ProxyStatusEnum status) {
		this.status = status;
	}
	
	public int getErrorCount() {
		return errorCount;
	}
	
	public void setErrorCount(int errorCount) {
		this.errorCount = errorCount;
	}
	
	public int getSuccessCount() {
		return successCount;
	}
	
	public void setSuccessCount(int successCount) {
		this.successCount = successCount;
	}
	
	
	
	public String getThreadName() {
		return threadName;
	}

	
	public void setThreadName(String threadName) {
		this.threadName = threadName;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((host == null) ? 0 : host.hashCode());
		result = prime * result + port;
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Proxy other = (Proxy) obj;
		if (host == null) {
			if (other.host != null)
				return false;
		}
		else if (!host.equals(other.host))
			return false;
		if (port != other.port)
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "[host=" + host + ", port=" + port + ", status=" + status + ", threadName=" + threadName + "]";
	}
	
}
